From: Giovanni Campagna Date: Thu, 24 Feb 2011 17:17:05 +0000 (+0100) Subject: Don't declare global variables X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~8859 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=15ec185be50475e2f57de4940e84d7767da4814e;p=gnome-shell.git Don't declare global variables Fix a typo in panel.js, and ensure that all variables used in functions are scoped to the block (using let), to avoid polluting the global namespace. https://bugzilla.gnome.org/show_bug.cgi?id=643210 --- diff --git a/js/ui/environment.js b/js/ui/environment.js index d6405b3a3..e83226202 100644 --- a/js/ui/environment.js +++ b/js/ui/environment.js @@ -17,7 +17,7 @@ function _patchContainerClass(containerClass) { // This one is a straightforward mapping of the C method containerClass.prototype.child_set = function(actor, props) { let meta = this.get_child_meta(actor); - for (prop in props) + for (let prop in props) meta[prop] = props[prop]; }; diff --git a/js/ui/panel.js b/js/ui/panel.js index a38bf9aa1..d1bf3fd4e 100644 --- a/js/ui/panel.js +++ b/js/ui/panel.js @@ -410,7 +410,7 @@ AppMenuButton.prototype = { let [minSize, naturalSize] = this._iconBox.get_preferred_height(forWidth); alloc.min_size = minSize; alloc.natural_size = naturalSize; - [minSizfe, naturalSize] = this._label.actor.get_preferred_height(forWidth); + [minSize, naturalSize] = this._label.actor.get_preferred_height(forWidth); if (minSize > alloc.min_size) alloc.min_size = minSize; if (naturalSize > alloc.natural_size) diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js index 06dec6f6d..d3acd3a5e 100644 --- a/js/ui/workspaceThumbnail.js +++ b/js/ui/workspaceThumbnail.js @@ -424,7 +424,7 @@ ThumbnailsBox.prototype = { this._indicatorY = 0; // only used when _animatingIndicator is true this._stateCounts = {}; - for (key in ThumbnailState) + for (let key in ThumbnailState) this._stateCounts[ThumbnailState[key]] = 0; this._thumbnails = []; @@ -441,7 +441,7 @@ ThumbnailsBox.prototype = { this._stateUpdateQueued = false; this._stateCounts = {}; - for (key in ThumbnailState) + for (let key in ThumbnailState) this._stateCounts[ThumbnailState[key]] = 0; // The "porthole" is the portion of the screen that we show in the workspaces